package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.GuestRoom;
import com.ruoyi.system.mapper.GuestRoomMapper;
import com.ruoyi.system.service.GuestRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GuestRoomServiceImpl implements GuestRoomService {

    @Autowired
    private GuestRoomMapper guestRoomMapper;

    @Override
    public List<GuestRoom> selectGuestRoomList(GuestRoom guestRoom) {
        return guestRoomMapper.selectGuestRoomList(guestRoom);
    }

    @Override
    public int insertGuestRoom(GuestRoom guestRoom) {
        if (StringUtils.isNotEmpty(guestRoom.getHouseNull().trim())) {
            if (guestRoom.getHouseNull().toUpperCase().equals("Y")) {
                guestRoom.setHouseNull("是");
            } else {
                guestRoom.setHouseNull("否");
            }
        }
        return guestRoomMapper.insertGuestRoom(guestRoom);
    }

    @Override
    public int updateGuestRoom(GuestRoom guestRoom) {
        return guestRoomMapper.updateGuestRoom(guestRoom);
    }

    @Override
    public int deleteGuestRoom(String numberId) {
        return guestRoomMapper.deleteGuestRoom(numberId);
    }
}
